﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace MyManageViewControl
{
    public partial class UserManageView : ManageView
    {
        public event EventHandler UserIdChange;

        public string UserId
        {
            get { return tbxUserId.Text; }
            set { tbxUserId.Text = value; }
        }

       

        public string FirstName
        {
            get { return tbxFirstName.Text; }
            set { tbxFirstName.Text = value; }
        }

       

        public string LastName
        {
            get { return tbxLastName.Text; }
            set { tbxLastName.Text = value; }
        }

        

        public string Email
        {
            get { return tbxEmail.Text; }
            set { tbxEmail.Text = value; }
        }

       

        public string Mobile
        {
            get { return tbxPhone.Text; }
            set { tbxPhone.Text = value; }
        }

       

        public DateTime BirthDay
        {
            get { return dtpBirthDay.Value; }
            set { dtpBirthDay.Value = value; }
        }

       

        public string Address
        {
            get { return tbxAddress.Text; }
            set { tbxAddress.Text = value; }
        }

        public int Role
        {
            get { return cbxUserRole.SelectedIndex + 1; }
            set { cbxUserRole.SelectedIndex = value - 1; }
        }

        public UserManageView()
        {
            InitializeComponent();
            
        }

        private void AdminManageView_Load(object sender, EventArgs e)
        {
            

        }

        private void tbxUserId_DoubleClick(object sender, EventArgs e)
        {
            cbxUserRole.SelectedIndex = 0;
            tbxFirstName.Text = "";
            tbxLastName.Text = "";
            dtpBirthDay.Value = DateTime.Now;
            tbxAddress.Text = "";
            tbxEmail.Text = "";
            tbxPhone.Text = "";

            if (UserIdChange != null) 
            {
                UserIdChange(sender, e);
            }
        }

    }
}
